"""drf_权限与过滤及其他组件 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from app01 import views
from rest_framework import routers

router = routers.SimpleRouter()
router.register('books', viewset=views.BookView)
print(router.urls)
urlpatterns = [
    path('admin/', admin.site.urls),
    path('login/', views.LoginView.as_view()),
    path('test/', views.TestView.as_view()),
    path('test1/', views.TestView2.as_view()),
    path('test2/', views.TestView3.as_view()),
    path('test3/', views.TestView4.as_view()),
    path('test4/', views.TestView5.as_view()),
    path('test5/', views.TestView6.as_view()),
    path('test6/', views.TestView7.as_view()),
    # path('books/', views.BookView.as_view(actions={'get': 'list', 'post': 'create'})),
    # re_path(r'^books/(?P<pk>\d+)/$', views.BookView.as_view(actions={'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    # re_path(r'^books/(?P<pk>\d+)/get_1/$', views.BookView.as_view(actions={'get': 'get_1'})),
    path('books2/', views.Book2View.as_view()),
]

urlpatterns += router.urls